package com.sugar.psych.assessment.module.business.dal.mysql.usermedal;

import java.util.*;

import com.sugar.psych.assessment.framework.common.pojo.PageResult;
import com.sugar.psych.assessment.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.sugar.psych.assessment.framework.mybatis.core.mapper.BaseMapperX;
import com.sugar.psych.assessment.module.business.dal.dataobject.usermedal.UserMedalDO;
import org.apache.ibatis.annotations.Mapper;
import com.sugar.psych.assessment.module.business.controller.admin.usermedal.vo.*;

/**
 * 用户获得勋章信息 Mapper
 *
 * @author Ysugar
 */
@Mapper
public interface UserMedalMapper extends BaseMapperX<UserMedalDO> {

    default PageResult<UserMedalDO> selectPage(UserMedalPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<UserMedalDO>()
                .eqIfPresent(UserMedalDO::getUserId, reqVO.getUserId())
                .eqIfPresent(UserMedalDO::getMedalId, reqVO.getMedalId())
                .betweenIfPresent(UserMedalDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(UserMedalDO::getId));
    }

}